
<script type="text/javascript">
var s_n_row = 0;
$(document).ready(function(){
	$(".s_n_load_more").click();
});
function s_n_loadMore(){
	ajaxRequest("offset="+s_n_row,"index.php?mod=home&childmod=notice&ajax=true&op=notice_load_more",s_n_onSuccess,s_n_onError);
}

function s_n_onSuccess(data){
	s_n_operatedone(data.code,data.message,data.data);
}
function s_n_onError(data){
	console.log(data);
	s_n_operatedone(-101,"服务器返回了未知的数据，请前往console查看");
}
function s_n_load_list(data){
	var $container = $("<div class='ui feed' id='offset-"+s_n_row+"'>")
	$.each(data,function(k,v){
		$container.prepend(s_n_loadNotice(v));
	});
	$("#notices").append($container);
}
function s_n_loadNotice(data){
	var $tmp = $("#notice_temple").clone();
	$tmp.attr("id","").attr("style","");
	if(data.sender==-1){
		$tmp.find(".s_notice_header").remove();
	}else{
		$tmp.find(".s_notice_header").attr("src",data.card.head_image_path);
		$tmp.find(".s_system_header").remove();
	}
	if(data.is_read==0){
		$tmp.find(".s_notice_content").html(data.header);
		$tmp.find(".s_notice_text").html("<b>"+data.content+"</b>");
	}else{
		$tmp.find(".s_notice_content").html(data.header);
		$tmp.find(".s_notice_text").html(data.content);
		}
	$tmp.find(".s_notice_date").html(data.date);
	return $tmp;
}
function s_n_operatedone(id,message,data){
	if(data.op=="load_more"){
		if(data.bottom){
			$(".s_n_load_more").html("到底了");
			$(".s_n_load_more").addClass("disabled");
		}
		s_n_load_list(data.data);
		s_n_row +=data.amount;
	}
}

</script>
<div class="ui feed" id="notices"></div>
<button class="ui fluid button s_n_load_more" onClick="if($(this).hasClass('disabled'))return; s_n_loadMore()">加载更多</button>
<div class="event" style="display: none" id="notice_temple">
	<div class="label">
		<i class="book icon s_system_header"></i>
		<img class="s_notice_header">
	</div>
	<div class="content">
		<div class="summary">
			<span class="s_notice_content"></span>
			<div class="date s_notice_date"></div>
		</div>
		<div class="extra text s_notice_text"></div>
	</div>
</div>